<!--
 * @Description: 右键菜单
 * @Author: HuiSir<273250950@qq.com>
 * @Date: 2022-03-02 11:31:03
 * @LastEditTime: 2025-10-15 18:28:39
-->
<template>
  <el-button type="primary" v-contextMenu="ctxMenuList">右键点击测试</el-button>
</template>

<script lang="ts" setup>
import { ElMessage } from "element-plus";
import { CtxMenuBtn } from "@/directives/contextMenu";

// 配置项
defineOptions({ name: "contextMenu", isFull: true });

// 右键菜单-关闭标签
const ctxMenuList: CtxMenuBtn[] = [
  {
    name: "菜单一",
    callback(el) {
      ElMessage("您点击了菜单一");
      console.log(el);
    },
  },
  {
    name: "菜单二",
    callback(el) {
      ElMessage("您点击了菜单二");
      console.log(el);
    },
  },
  {
    name: "菜单三",
    callback(el) {
      ElMessage("您点击了菜单三");
      console.log(el);
    },
  },
];
</script>
